<template>
    <BPTable ref='tableRef' align='center' row-key='id' :columns='columns' :api='pageApi' :buttons='buttons'>
        
    </BPTable>
</template>

<script lang='ts' setup>
    import { ref } from "vue";
    import { pageApi } from '@/api/User'
    import { parseTime } from "@/utils";
    import { CLIENT_SOURCE } from "@/constant";

    CLIENT_SOURCE

    const tableRef = ref()


    const buttons = ref<SearchButton[]>([])

    const columns = ref<Column[]>([
        {
            dataIndex : 'nickname',
            title : '昵称',
            inSearch : true,
        },

        {
            dataIndex : 'source',
            title : '来源',
            customRender({text}) {
                return CLIENT_SOURCE[text]
            }
        },

        {
            dataIndex : 'amount',
            title : '充值余额(元)',
        },

        {
            dataIndex : 'rewardAmount',
            title : '赠送余额(元)',
        },

        {
            title : '最近登录',
            dataIndex : 'lastLoginTime',
            align : 'center',
            customRender({text}) {
                return parseTime(text)
            }
        },

        {
            title : '注册时间',
            dataIndex : 'registerTime',
            align : 'center',
            customRender({text}) {
                return parseTime(text)
            }
        }
    ])

    const dataRows = ref<any[]>([])
    
</script>